package news.web;


import com.github.pagehelper.PageInfo;
import news.model.CommonResult;
import news.model.News;
import news.model.SystemInfo;
import news.service.SystemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/admin/system")
@RestController
public class SystemController {

    @Autowired
    private SystemService systemService;

    @RequestMapping("/systems")
    public CommonResult systems(@RequestBody SystemInfo systemInfo){
        SystemInfo systemInfo1 = systemService.systemList(systemInfo);
        CommonResult commonResult = new CommonResult(200, systemInfo1, "系统列表查询成功");
        return commonResult;
    }

    @PostMapping("/saveSystem")
    public CommonResult saveSystem(@RequestBody SystemInfo systemInfo){
        systemService.saveSystem(systemInfo);
        return new CommonResult(200,"修改系统信息成功");
    }
}
